package com.dynamic.data.permission.model;

/**
 * 运行时上下文环境(可获取当前登录用户, 从Spring容器中获取Bean等)
 */
public class UserContextHolder {

    public static final ThreadLocal<UserInfoContext> USER_INFO_THREAD_LOCAL = new ThreadLocal<>();


    public static void set(UserInfoContext userInfoContext) {
        USER_INFO_THREAD_LOCAL.set(userInfoContext);
    }

    public static UserInfoContext get() {
        return USER_INFO_THREAD_LOCAL.get();
    }

    public static void clear() {
        USER_INFO_THREAD_LOCAL.remove();
    }

}